'use strict';
const path = require('path');
module.exports = appInfo => {
  const config = {
      middleware: [ 'errorHandler' ],
      errorHandler: {
        enable: true,
        // 非 `/api/` 路径不在这里做错误处理，留给默认的 onerror 插件统一处理
        //match: '/api',
        errorPageUrl: '',
        appErrorFilter: null,
      },
      view: {
          defaultViewEngine: 'nunjucks',
          mapping: {
              '.tpl': 'nunjucks',
          },
          root: [
              path.join(appInfo.baseDir, 'app/view'),
              path.join(appInfo.baseDir, 'path/to/another'),
          ].join(',')
      },
      security: {

        xframe: {
          enable: false,
        },
        csrf: {
          enable: false,
          headerName: 'x-csrf-token',
          cookieName: 'csrfToken',
        },
      },
      mysql : {
      // database configuration
          client: {
              // host
              host: 'localhost',
              // port
              port: '3306',
              // username
              user: 'root',
              // password
              password: 'root',
              // database
              database: 'test',
          },
          // load into app, default is open
          app: true,
          // load into agent, default is close
          agent: false,
      },  
      redis : {
      // database configuration
          client: {
              // host
              host: '127.0.0.1',
              // port
              port: '6379',

              password: '',
              
              db: '0',
          },
          // load into app, default is open
          app: true,
          // load into agent, default is close
          agent: false,
      },
      
  };

  // should change to your own
  config.keys = appInfo.name + '_1489048554806_6546';

  return config;
};
